package elitech.vietnam.weatherfashion.service.unittest;

import junit.framework.TestCase;
import org.junit.Test;

import elitech.vietnam.weatherfashion.location.MyLocationObject;
import elitech.vietnam.weatherfashion.location.MyLocationObject2;
import elitech.vietnam.weatherfashion.location.MyLocationService;
import elitech.vietnam.weatherfashion.ultilities.GoogleMapService;

public class LocationServiceTest extends TestCase {
	@Test(timeout = 5000)
	public void testGetCountryCodeByGoogleMap() {
		// // // MyClass is tested
		assertEquals("ko",
				GoogleMapService.getCountryLanguageCode(37.565943, 126.977722));
	}

	@Test(timeout = 5000)
	public void testGetLocationByInternet() {

		MyLocationObject myLocationObject = MyLocationService.getLocation();

		// // // MyClass is tested
		assertEquals("VN", myLocationObject.getCountryCode());
		assertEquals("14.161.37.71", myLocationObject.getPublicIp());
		assertEquals("Ho Chi Minh", myLocationObject.getRegion());
		assertEquals(10.8142f, myLocationObject.getLatitude());
		assertEquals(106.6440f, myLocationObject.getLongitude());
	}

	@Test(timeout = 5000)
	public void testGetLocationByInternet2() {
		// // // MyClass is tested

		MyLocationObject2 myLocationObject = MyLocationService.getLocation2();

		// // // MyClass is tested
		assertEquals("VN", myLocationObject.getCountryCode());
		assertEquals("14.161.37.71", myLocationObject.getPublicIp());
	}
}
